import React,{Suspense} from 'react';
import {Switch,Route,Redirect} from "react-router-dom"
import PrivateRoute from "./utils/PrivateRoute"
// 路由规则
let Login=React.lazy(()=>import("./containers/login/Login.jsx"))
let Register=React.lazy(()=>import("./containers/register/Register.jsx"))
let Index=React.lazy(()=>import("./containers/index/index"))
function App() {
  return (
    <div>
      <React.Suspense fallback={<div>正在加载中。。。。</div>}>
        <Switch>
          <Route path="/login" component={Login}></Route>
          <Route path="/register" component={Register}></Route>
          <PrivateRoute path="/index" component={Index}></PrivateRoute>
          <Redirect to="/login"></Redirect>
        </Switch>
      </React.Suspense>
    </div>
  );
}

export default App;
